var initialState={
    fakeAuth:{
        isAuthenticated: false,
        authenticate(cb) {
          this.isAuthenticated = true
          setTimeout(cb, 100) // fake async
        },
        signout(cb) {
          this.isAuthenticated = false
          setTimeout(cb, 100)
        }
    },
    username:'',
    regAuth:false
}

function auth(state=initialState,action){
    switch(action.type){
        case "SAVENAME":
            return Object.assign({},state,{username:action.data});
        case "REGISTERAUTH":
            return Object.assign({},state,{regAuth:action.data});
        default:
            return state;
    }
}

export default auth;